﻿using System;
using System.Collections.Generic;
using System.Text;
using MarketSimulator.Utils.Maps;
using jade.core;

namespace MarketSimulator.Utils.Attributes
{
    /// <summary>
    /// Transporter Attributes
    /// </summary>
    public class TransporterAttributes : GeneralAttributes
    {
        #region Properties

        public const string TransporterServiceName = "[TRANSPORTER]";

        /// <summary>
        /// Product Name | Quantity | Price per Unit
        /// </summary>
        private const string TransporterInfoFormat = "[{0} | {1} |cap = {2} | price = {3}]";

        /// <summary>
        /// Product List
        /// </summary>
        public Route Route { get; private set; }

        /// <summary>
        /// Seller Location
        /// </summary>
        public City Location { get; private set; }

        /// <summary>
        /// Transport Capacity
        /// </summary>
        public long Capacity { get; private set; }

        /// <summary>
        /// Price per transport
        /// </summary>
        public double PricePerTransport { get; private set; }

        #endregion

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="location"></param>
        /// <param name="shoppingList"></param>
        public TransporterAttributes(Agent agent, Route route, long capacity, double pricePerTransport, Action<string> agentsChat) : base(agentsChat)
        {
            JadeAgent = agent;
            Route = route;
            Capacity = capacity;
            PricePerTransport = pricePerTransport;
        }

        #region Methods
        
        /// <summary>
        /// Register Actor
        /// </summary>
        public override void RegisterAgent()
        {
            YellowPages.RegisterService(TransporterServiceName, JadeAgent);
        }

        /// <summary>
        /// Get Product Information as String
        /// </summary>
        /// <returns></returns>
        public string GetTransporterInfoString()
        {
            return string.Format(TransporterInfoFormat, Route.CityA, Route.CityB, Capacity, PricePerTransport);
        }

        #endregion
    }
}
